//using System;
//using System.Collections.Generic;

//using System.Linq;
//using System.Text;

//namespace ClientTools.Client.Library.Provider
//{
//    public class DatabaseProvider: 
//        Interfaces.IProvider, 
//        Interfaces.ILogging, 
//        Interfaces.IStats, 
//        Interfaces.IVersions 
//    {

//        private string _ConnectionString;
//        private ClientTools.Library.Logging.LogManager _LogManager;
//        private ClientTools.Library.Stats.StatsManager _StatsManager;
//        private ClientTools.Library.Versions.VersionManager _VersionManager;

//        public string ConnectionString
//        {
//            get { return _ConnectionString; }
//            set { _ConnectionString = value; this.InitObjects(); }
//        }

//        public DatabaseProvider()
//        {
//        }

//        private void InitObjects() 
//        {
//            _LogManager = new ClientTools.Library.Logging.LogManager(_ConnectionString);
//            _StatsManager = new ClientTools.Library.Stats.StatsManager(_ConnectionString);
//            _VersionManager = new ClientTools.Library.Versions.VersionManager(_ConnectionString);
//        }

//        public DatabaseProvider(string connectionString) 
//        {
//            _ConnectionString = connectionString;
//            this.InitObjects();
//        }

//        #region I_Logging Member

//        public ClientTools.Library.Logging.LogInfoCollection GetLogInfos()
//        {
//            ClientTools.Library.Logging.LogInfoCollection returnValue = new ClientTools.Library.Logging.LogInfoCollection();
//            foreach (ClientTools.Library.Logging.LogInfo li in _LogManager.GetLogInfos())
//            {
//                returnValue.Add(li);
//            }
//            return returnValue;
//        }

//        public ClientTools.Library.Logging.LogCollection GetLogs(DateTime? startDate, DateTime? endDate, string logHeader, int? userId, int? nodeId, int? maxRows, string comment)
//        {
//            return _LogManager.GetLogs(startDate, endDate, logHeader, userId, nodeId, maxRows,comment);
//        }

//        public int DeleteLogsByIDs(int[] logIds)
//        {
//            return _LogManager.DeleteLogsByIDs(logIds);
//        }

//        public int DeleteLogsByHeader(string logHeader)
//        {
//            return _LogManager.DeleteLogsByHeader(logHeader);
//        }

//        public int DeleteLogsByDate(DateTime date)
//        {
//            return _LogManager.DeleteLogsByDate(date);
//        }

//        #endregion

//        #region I_Stats Member

//        public ClientTools.Library.Stats.StatsInfo DeleteStatsByDate(DateTime date)
//        {
//            return _StatsManager.DeleteStatsByDate(date);
//        }

//        public ClientTools.Library.Stats.StatsInfo GetStatsInfo()
//        {
//            return _StatsManager.GetStatsInfo();
//        }

//        #endregion

//        #region I_Provider Member

//        public string Providername
//        {
//            get { return "Database Provider"; }
//        }

//        #endregion

//        //#region I_Versions Member

//        //public ClientTools.Library.Versions.VersionInfo GetVersionInfos()
//        //{
//        //    return _VersionManager.GetVersionInfos();
//        //}

//        //public ClientTools.Library.Versions.VersionInfo XX_DeleteVersionsByDate(DateTime date)
//        //{
//        //    return _VersionManager.DeleteVersionsByDate(date);
//        //}

//        //public ClientTools.Library.Versions.VersionInfo XX_DeleteVersionsByNumberOfItems(int numberOfItems)
//        //{
//        //    return _VersionManager.DeleteVersionsByNumberOfItems(numberOfItems);
//        //}

//        //public ClientTools.Library.Nodes.NodeCollection GetNodes(int parentId, bool recursive)
//        //{
//        //    throw new NotImplementedException();
//        //}

//        //public ClientTools.Library.Versions.VersionCollection GetVersions(int id)
//        //{
//        //    throw new NotImplementedException();
//        //}

//        //public ClientTools.Library.Versions.VersionInfo DeleteVersion(Guid guid)
//        //{
//        //    throw new NotImplementedException();
//        //}

//        //public ClientTools.Library.Versions.VersionInfo GetChildrenVersionInfos(int id)
//        //{
//        //    throw new NotImplementedException();
//        //}

//        //public ClientTools.Library.Versions.VersionInfo GetNodeVersionInfos(int id)
//        //{
//        //    throw new NotImplementedException();
//        //}

//        //#endregion


//        #region IVersions Members

//        public ClientTools.Library.Versions.VersionInfo GetVersionInfos()
//        {
//            return _VersionManager.GetVersionInfos();
//        }

//        public ClientTools.Library.Versions.VersionInfo GetVersionInfos(int nodeId)
//        {
//            return _VersionManager.GetVersionInfos(nodeId);
//        }

//        public ClientTools.Library.Versions.VersionInfo GetVersionInfos(int nodeId, bool includeChildren)
//        {
//            return _VersionManager.GetVersionInfos(nodeId, includeChildren);
//        }

//        public ClientTools.Library.Versions.VersionInfo GetChildrenVersionInfos(int nodeId)
//        {
//            return _VersionManager.GetChildrenVersionInfos(nodeId);
//        }

//        public ClientTools.Library.Versions.VersionCollection GetVersions(int nodeId)
//        {
//            return _VersionManager.GetVersions(nodeId);
//        }

//        public ClientTools.Library.Versions.VersionInfo XX_DeleteVersionsByDate(DateTime date)
//        {
//            throw new NotImplementedException();
//        }

//        public ClientTools.Library.Versions.VersionInfo XX_DeleteVersionsByNumberOfItems(int numberOfItems)
//        {
//            throw new NotImplementedException();
//        }

//        public ClientTools.Library.Versions.VersionInfo DeleteVersion(Guid guid)
//        {
//            return _VersionManager.DeleteVersion(guid);
//        }

//        public ClientTools.Library.Versions.VersionInfo DeleteVersionsByDate(DateTime date, int id)
//        {
//            throw new NotImplementedException();
//        }

//        private Model.DCDataContext dc;// = new ClientTools.Client.Library.Model.DCDataContext(this.ConnectionString);
//        public Model.DCDataContext DC 
//        { 
//            get 
//            {
//                if (dc == null) 
//                    dc = new ClientTools.Client.Library.Model.DCDataContext(this.ConnectionString);
//                return dc;
//            }
//        }


//        public ClientTools.Library.Nodes.NodeCollection GetNodes(int parentId, bool recursive)
//        {
            

//            ClientTools.Library.Nodes.NodeCollection returnValue = new ClientTools.Library.Nodes.NodeCollection();

//            foreach (var item in (from x in DC.umbracoNodes join y in DC.cmsDocuments on x.id equals y.nodeId where y.published && x.parentID == parentId select new ClientTools.Library.Nodes.Node() { Id = x.id, Name = x.text, NodeTypeAlias = "", NodeTypeId = -1, Properties   }))
//            {

//            }

//        }

//        #endregion

//    }
//}
